Link traceability / in and out links

I am learning DXL on-the-fly to speed up some testing we have to do. In a nutshell, Module A (test files) has out-links only to Module B. Module B (requirements) has in- and out-links, but I am concerned with in-links to Module C (software prgram units). What I would like to do is start at Module A and generate a text file that says a test in Module A covers the appropriate program units in Module C. I have looked at some sample scripts and have an idea how to proceed. For now, everyone does the test to program unit matching manually (ugh!), but writing a script would significantly reduce our workload. The admins for DOORS have made it clear that they will not establish links as I want, so scripting is the solution.I am looking for advice or pointers for developing the script.
SystemAdmin - Mon Feb 23 14:00:54 EST 2009

Re: Link traceability / in and out links
Doug.Zawacki - Mon Feb 23 14:41:34 EST 2009

Hi JPesula,

I have attached some code which you should be able to work with. This will create a report for something that you are looking for. It's a good head start at least. Good luck.
Attachments

attachment_14220433_LinksExample.dxl

Re: Link traceability / in and out links
SystemAdmin - Tue Feb 24 06:43:45 EST 2009

Doug.Zawacki - Mon Feb 23 14:41:34 EST 2009
Hi JPesula,

I have attached some code which you should be able to work with. This will create a report for something that you are looking for. It's a good head start at least. Good luck.

Thank you so very much for the code snippet - it was much more than I expected. I probably figured out about 70% of what you sent - it was the last 30% that was the hardest. This will definitely get me on the track to getting the script done. Offhand, do you know of any good sites or documentation that show how the requiremnts and links look in terms of a data structure - that would be useful for future uses.

Re: Link traceability / in and out links
llandale - Fri Feb 27 15:53:32 EST 2009

Didn't read the other code snippettes.

I think you are saying: your structure is like this: C<-B<-A, where C is Program requiremrents, B is system requirements, and A are tests.

I think you are asking: For all requirements in C, figure out if they are 'tested'; where a C requirement is 'tested' if all its linked B requirements are linked to tests in A.

If so, below is an outline of how I would approach it.

>Louie

// ***** Function IsBreqTested() *****
bool IsBreqTested(Object oB)
{// for specified requirement in module B, return if its linked to a Test in A.

for all incoming links to oB
{If I care about link modules, figure out if this link is in the right module
... if not then 'continue'
get an Object handle on the source of the link: oC = source(lnk).
if oC is in module C return(true) // *** FOUND RETURN ***
} // end for incoming B links
return(false) // *** no such link found ***
} // end IsBreqTested()

// ***** Function IsCreqTested() *****
bool IsCreqTested(Object oC)
{ // for specified requirement in module C, return if its tested, meaning
// all its linked B requirements have a A test link, and there is at least
// one such B associated with this C.
bool FoundOne = false
for all incoming links to oC
{if I care about link module, 'continue' if this link isn't in the right link module
oB = source(lnk)
if (oB is not in module B) continue
if (! IsBreqTested(oB)) return(false) //*** Untested B requirement ***
FouneOne = true // There is at least one tested B for this C
} // end for links into oB
return(FoundOne) // False if no such B; true of All Bs are linked from As.
} // end function IsCreqTested()

//***** Function MakeCmodReport *****
void MakeCmodReport(Module mC)
{// for all requirements in C, report those not tested
for oC in entire mC do
{ if (isDeleted(oC)) continue // ignore deleted C
if (oC is not a requirement) continue // Add criteria here, such as Headings
if (!IsCreqTested(oC)) print "Not tested: " (identifier(oC)) "\n"
}
}// end MakeCmodReport()

//***** Function Main *****
void Main()
{ Module mC = read(module C)
open module B
open module A
MakeCmodReport(mC)
}// end Main()

Main() // Lets go.

Re: Link traceability / in and out links
SystemAdmin - Wed Mar 04 10:02:35 EST 2009

llandale - Fri Feb 27 15:53:32 EST 2009
Didn't read the other code snippettes.

I think you are saying: your structure is like this: C<-B<-A, where C is Program requiremrents, B is system requirements, and A are tests.

I think you are asking: For all requirements in C, figure out if they are 'tested'; where a C requirement is 'tested' if all its linked B requirements are linked to tests in A.

If so, below is an outline of how I would approach it.

>Louie

// ***** Function IsBreqTested() *****
bool IsBreqTested(Object oB)
{// for specified requirement in module B, return if its linked to a Test in A.

for all incoming links to oB
{If I care about link modules, figure out if this link is in the right module
... if not then 'continue'
get an Object handle on the source of the link: oC = source(lnk).
if oC is in module C return(true) // *** FOUND RETURN ***
} // end for incoming B links
return(false) // *** no such link found ***
} // end IsBreqTested()

// ***** Function IsCreqTested() *****
bool IsCreqTested(Object oC)
{ // for specified requirement in module C, return if its tested, meaning
// all its linked B requirements have a A test link, and there is at least
// one such B associated with this C.
bool FoundOne = false
for all incoming links to oC
{if I care about link module, 'continue' if this link isn't in the right link module
oB = source(lnk)
if (oB is not in module B) continue
if (! IsBreqTested(oB)) return(false) //*** Untested B requirement ***
FouneOne = true // There is at least one tested B for this C
} // end for links into oB
return(FoundOne) // False if no such B; true of All Bs are linked from As.
} // end function IsCreqTested()

//***** Function MakeCmodReport *****
void MakeCmodReport(Module mC)
{// for all requirements in C, report those not tested
for oC in entire mC do
{ if (isDeleted(oC)) continue // ignore deleted C
if (oC is not a requirement) continue // Add criteria here, such as Headings
if (!IsCreqTested(oC)) print "Not tested: " (identifier(oC)) "\n"
}
}// end MakeCmodReport()

//***** Function Main *****
void Main()
{ Module mC = read(module C)
open module B
open module A
MakeCmodReport(mC)
}// end Main()

Main() // Lets go.

I appreciate your response, Louie. I was able to tweak Doug's to work with my requirments setup. I will give yours a go as well - there is never just one way to write code.